<template>
	<view class="page bg-white">
		<view class="main">
			<!-- 选择要退出的班级 -->
			<u-text color="#333" size="32rpx" text="选择要退出的班级" bold></u-text>
			<view class="form-item" @click="showClassPicker = true">
				<u-text :text="formData.classInfo || '请选择要退出的班级'" size="32rpx"
					:color="formData.classInfo ? '#333' : '#999'"></u-text>
				<u-icon name="arrow-down" size="32rpx" color="#999"></u-icon>
			</view>

			<!-- 退班时间  -->
			<u-text margin="60rpx 0 0 0" color="#333" size="32rpx" text="退班时间" bold></u-text>
			<view class="form-item flex-1" @click="showStartDate = true">
				<u-text :text="formData.startDate ? dayjs(formData.startDate).format('YYYY-MM-DD') : '请选择退班时间'" size="32rpx"
					:color="formData.startDate ? '#333' : '#999'"></u-text>
			</view>

			<!-- 退班原因 -->
			<u-text margin="60rpx 0 0 0" color="#333" size="32rpx" text="退班原因" bold></u-text>
			<view class="margin-top-sm">
				<u-textarea :border="false" placeholderStyle="font-size:32rpx;color:#999" style="background:#f7f7f7"
					v-model="formData.reason" placeholder="请输入退班原因"></u-textarea>
			</view>

			<!-- 选择要加入的班级弹窗 -->
			<up-picker :closeOnClickOverlay="true" :show="showClassPicker" :columns="classList"
				@close="showClassPicker = false" @confirm="handleClassConfirm"></up-picker>

			<!-- 开始时间选择器 -->
			<up-datetime-picker :closeOnClickOverlay="true" :show="showStartDate" mode="date" format="YYYY-MM-DD"
				@close="showStartDate = false" @cancel="showStartDate = false"
				@confirm="handleStartDateConfirm"></up-datetime-picker>
		</view>
		<view class="footer" :style="{ boxShadow: '0rpx -4rpx 36rpx 0rpx ' + themeTertiary }">
			<u-button shape="circle" size="large" :color="themePrimary" text="提交审核"></u-button>
		</view>
	</view>
</template>
<script setup>
import { ref } from 'vue'
import { useTheme } from '@/composables/useTheme';
import dayjs from 'dayjs';
const { themePrimary, themeTertiary } = useTheme();

// 报名周期弹窗
const showStartDate = ref(false)
const formData = ref({
	startDate: '',
	classInfo: null,
})
// 选择要加入的班级弹窗
const showClassPicker = ref(false)
// 选择学员弹窗
const showStudentPopup = ref(false)

// 班级列表
const classList = ref([['托管班：一年级（A）班', '周末班：一年级-数学（A）班']])

const handleClassConfirm = (e) => {
	console.log(e)
	showClassPicker.value = false
	formData.value.classInfo = e.value[0]
}

const handleStartDateConfirm = (e) => {
	console.log(e)
	showStartDate.value = false
	formData.value.startDate = e.value
}

</script>
<style scoped lang="scss">
.form-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #F7F7F7;
	padding: 30rpx;
	margin-top: 20rpx;
	border-radius: 20rpx;
}

.camera-icon {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 54rpx;
	height: 54rpx;
}
</style>